/**
 *Copyright (c) 2024 watereyes
 * safetymanagement is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.hiddendanger.mapper;

import com.koron.hiddendanger.domain.PerformancePlan;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface PerformancePlanMapper {

    /**
     * 根据主键查询检查计划详情
     *
     * @param id
     * @return
     */
    PerformancePlan queryOne(@Param("id") String id);

    /**
     * 根据指定条件查询检查计划列表
     *
     * @param name
     * @param planCreater
     * @param corpCode
     * @param gridCode
     * @param executors
     * @param planState
     * @param useState
     * @param repeatType
     * @param start
     * @param rows
     * @return
     */
    List<PerformancePlan> queryByCondition(@Param("userCode") String userCode, @Param("name") String name, @Param("planCreater") String planCreater, @Param("corpCode") String corpCode,
                                           @Param("gridCode") String gridCode, @Param("executors") String executors,
                                           @Param("planState") Integer planState, @Param("useState") Integer useState, @Param("repeatType") Integer repeatType,
                                           @Param("start") Integer start, @Param("rows") Integer rows);

    /**
     * 根据指定条件统计检查计划
     *
     * @param name
     * @param planCreater
     * @param corpCode
     * @param gridCode
     * @param executors
     * @param planState
     * @param repeatType
     * @return
     */
    Integer countByCondition(@Param("userCode") String userCode,@Param("name") String name, @Param("planCreater") String planCreater, @Param("corpCode") String corpCode,
                             @Param("gridCode") String gridCode, @Param("executors") String executors, @Param("planState") Integer planState,
                             @Param("useState") Integer useState, @Param("repeatType") Integer repeatType);

    /**
     * 新增检查计划
     *
     * @param bean
     * @return
     */
    Integer insert(@Param("bean") PerformancePlan bean);

    /**
     * 修改检查计划
     *
     * @param bean
     * @return
     */
    Integer update(@Param("bean") PerformancePlan bean);

    /**
     * 根据主键逻辑删除检查计划
     *
     * @param id
     * @return
     */
    Integer dummyRemove(@Param("id") String id);

    /**
     * 物理删除检查计划
     *
     * @param idList
     * @return
     */
    Integer deleteBatch(@Param("idList") List<String> idList);

    /**
     * app端查询跟自己相关的计划列表
     *
     * @param complexCode 用户code_所在部门code
     * @param code
     * @return
     */
    List<PerformancePlan> appList(@Param("complexCode") String complexCode, @Param("code") String code, @Param("start") Integer start, @Param("rows") Integer rows);

    /**
     * app端统计与自己相关的任务
     *
     * @param complexCode 用户code_所在部门code
     * @param code
     * @return
     */
    Integer countAppList(@Param("complexCode") String complexCode, @Param("code") String code);

    /**
     * PC端首页安全工作的安全计划列表接口
     *
     * @param complexCode 用户code_所在部门code
     * @param code        用户code
     * @param start
     * @param rows
     * @return
     */
    List<PerformancePlan> indexPerformancePlanList(@Param("complexCode") String complexCode, @Param("code") String code, @Param("start") Integer start, @Param("rows") Integer rows);

    /**
     * 统计PC端首页安全工作的安全计划数量接口
     *
     * @param complexCode 用户code_所在部门code
     * @param code
     * @return
     */
    Integer countIndexPerformancePlanList(@Param("complexCode") String complexCode, @Param("code") String code);

    /**
     * 批量获取检查计划数据
     *
     * @param idLists
     * @return
     */
    List<PerformancePlan> getPlanByIds(@Param("idLists") List<String> idLists);

    Integer updatePlanState(@Param("planState") Integer planState, @Param("idLists") List<String> idLists);

    Integer delete(@Param("id") String id);

    List<PerformancePlan> queryAllOnUse(@Param("planState") Integer planState, @Param("useState") Integer useState);
}
